package com.inspur.cloud.enums;

public enum  QuotaEnum {
    MB(1, 1024L * 1024L),
    GB(2, 1024L * 1024L * 1024L),
    TB(3, 1024L * 1024L * 1024L * 1024L);

    private Integer type;
    private long size;

    QuotaEnum(Integer type, long size) {
        this.type = type;
        this.size = size;
    }

    public static  long getSizeByType(Integer type) {
        if(type==null) return GB.size;
        for (QuotaEnum e : QuotaEnum.values()) {
            if(e.getType().equals(type)){
                return e.getSize();
            }
        }
        return GB.size;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }
}
